package net.csdra.libraryborrowing.service.book;

import net.csdra.libraryborrowing.domain.book.BookInfo;
import net.csdra.libraryborrowing.domain.user.UserBorrowState;
import net.csdra.libraryborrowing.service.PageEntity;
import net.csdra.libraryborrowing.service.book.form.BookDetails;
import org.springframework.data.domain.Page;

import java.nio.file.AccessDeniedException;
import java.util.List;

/**
 * Created by msf on 2017/10/16.
 */
public interface BookInfoService {
    /**
     * 根据key搜索书籍列表（可能存在like多个字段）
     *
     * @param searchBookInfo
     * @return
     */
    public Page<BookInfo> searchBookInfo(SearchBookInfo searchBookInfo);

    /**
     * 获取当前用户购物车所有书籍
     * 根据UserId查询BookStorageBox,
     * 根据BookStorageBox获取BookInfo
     * 只能产生一条数据库查询
     *
     * @param getBookInfoByUserBorrow
     * @return List<T extends BookInfo>
     */
    public List<BookInfo> getBookInfoByBookStorageBox(GetBookInfoByBookStorageBox getBookInfoByUserBorrow) throws AccessDeniedException;

    /**
     * 根据bookInfoId获取详细信息
     *
     * @param getBookDetail
     * @return BookInfo extends BookInfo
     */
    public BookInfo getBookDetail(GetBookDetail getBookDetail);

    /**
     * 根据userBorrowState获取BookInfo(查询我的历史)
     * 只能产生一条数据库查询
     *
     * @param getBookInfoByUserBorrow
     * @return
     */
    public Page<BookInfo> getBookInfoByUserBorrow(GetBookInfoByUserBorrow getBookInfoByUserBorrow) throws AccessDeniedException;

    /**
     * 根据分类id获取书籍列表
     *
     * @param getBookListByCategory
     * @return
     */
    public Page<BookInfo> getBookListByCategory(GetBookListByCategory getBookListByCategory);

    class GetBookListByCategory extends PageEntity {
        List<String> categoryIds;

        public List<String> getCategoryIds() {
            return categoryIds;
        }

        public void setCategoryIds(List<String> categoryIds) {
            this.categoryIds = categoryIds;
        }
    }

    class SearchBookInfo extends PageEntity {
        String key;

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }
    }

    class GetBookInfoByBookStorageBox {

    }

    class GetBookInfoByUserBorrow extends PageEntity{
        String userBorrowState;

        public String getUserBorrowState() {
            return userBorrowState;
        }

        public void setUserBorrowState(String userBorrowState) {
            this.userBorrowState = userBorrowState;
        }
    }

    class GetBookDetail {
        String bookInfoId;

        public String getBookInfoId() {
            return bookInfoId;
        }

        public void setBookInfoId(String bookInfoId) {
            this.bookInfoId = bookInfoId;
        }
    }
}
